<!DOCTYPE html>
<html>
    <head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>用户管理- 全部用户列表</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="shortcut icon" href="../favicon.ico">
	<link href="__PUBLIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link rel="stylesheet" href="__PUBLIC__/css/ace.min.css"/>
	<link href="__PUBLIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	<link href="__PUBLIC__/css/animate.css" rel="stylesheet">
	<link href="__PUBLIC__/css/style.css?v=4.1.0" rel="stylesheet">
	<script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script>
	<style>
	    .table-container {
		overflow: auto;
	    }

	    .img {
		max-width: 64px;
		max-height: 64px;
	    }
	</style>
    </head>
    <body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
	    <div class="row">
		<div class="col-sm-12">
		    <div class="ibox float-e-margins">
			<div class="ibox-title">
			    <h5>用户管理-
				<small>全部用户列表</small>
			    </h5>
			    <div class="ibox-tools">
			    </div>
			</div>
			<div class="ibox-content">
			    <div class="dataTables_filter">
				<form action="__SELF__" id="form1">
				    <if condition="$app_code eq ''">
					<label>
					    <select name="ddlapp" id="ddlapp" onchange="form_submit()">
						<option value="0">-项目-</option>
						<volist name="apparr" id="apparr">
						    <option value="<{$apparr.app_flag}>" <if condition="$search.appsel eq $apparr['app_flag']">selected</if>><{$apparr.app_name}></option>
						</volist>
					    </select>
					</label>&nbsp;
				    </if>
				    <label>
					<select name="ddlsex" id="ddlsex" onchange="form_submit()">
					    <option value="0">-性别-</option>
					    <volist name="sexarr" id="sexarr">
						<option value="<{$sexarr.value}>" <if condition="$search.sexsel eq $sexarr['value']">selected</if>><{$sexarr.text}></option>
					    </volist>
					</select>
				    </label>&nbsp;
				    <label>
					<select name="ddlidstate" id="ddlidstate" onchange="form_idstate_submit()">
					    <option value="0">-认证-</option>
					    <volist name="idstatearr" id="idstatearr">
						<option value="<{$idstatearr.value}>" <if condition="$search.idstatesel eq $idstatearr['value']">selected</if>><{$idstatearr.text}></option>
					    </volist>
					</select>
				    </label>&nbsp;
<!--				    <label>
					<select name="ddlrecom" id="ddlrecom" onchange="form_submit()">
					    <option value="0">-推荐-</option>
					    <volist name="recomarr" id="recomarr">
						<option value ="<{$recomarr.value}>" <if condition="$search.recomsel eq $recomarr['value']">selected</if>><{$recomarr.text}></option>
					    </volist>
					</select>
				    </label>&nbsp;
				    <label>
					<select name="ddlactive" id="ddlactive" onchange="form_submit()">
					    <option value="0">-活跃-</option>
					    <volist name="activearr" id="activearr">
						<option value ="<{$activearr.value}>" <if condition="$search.activesel eq $activearr['value']">selected</if>><{$activearr.text}></option>
					    </volist>
					</select>
				    </label>&nbsp;
				    <label>
					<select name="ddlhot" id="ddlhot" onchange="form_submit()">
					    <option value="0">-排行-</option>
					    <volist name="hotarr" id="hotarr">
						<option value ="<{$hotarr.value}>" <if condition="$search.hotsel eq $hotarr['value']">selected</if>><{$hotarr.text}></option>
					    </volist>
					</select>
				    </label>&nbsp;-->
				    <label>
					<select name="ddlflag" id="ddlflag" onchange="form_flag_submit()">
					    <option value="0">-上下架-</option>
					    <volist name="flagarr" id="flagarr">
						<option value="<{$flagarr.value}>" <if condition="$search.flagsel eq $flagarr['value']">selected</if>><{$flagarr.text}></option>
					    </volist>
					</select>
				    </label>&nbsp;
<!--				    <if condition='$login_type eq 2'>
					<else/>
					<label>
					    <select name="ddlagent" id="ddlagent" onchange="form_submit()">
						<option value="0">-代理-</option>
						<volist name="agentarr" id="agentarr">
						    <option value ="<{$agentarr.value}>" <if condition="$search.agentsel eq $agentarr['value']">selected</if>><{$agentarr.text}></option>
						</volist>
					    </select>
					</label>&nbsp;
				    </if>-->
				    <label>
					<select name="ddlstate" id="ddlstate" onchange="form_submit()">
					    <option value="0">-状态-</option>
					    <volist name="statearr" id="statearr">
						<option value="<{$statearr.value}>" <if condition="$search.statesel eq $statearr['value']">selected</if>><{$statearr.text}></option>
					    </volist>
					</select>
				    </label>
				    <label>
					<input type="text" id="txtbegintime" name="txtbegintime" placeholder="请输入开始时间"
					       readonly="readonly" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm'})"
					       value="<{$search.begintime}>"/>
				    </label>
				    <label>
					<input type="text" id="txtendtime" name="txtendtime" placeholder="请输入结束时间"
					       readonly="readonly" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm'})"
					       value="<{$search.endtime}>"/>
				    </label>
				    <label>
					<input type="text" id="txtkeyword" name="txtkeyword" value="<{$search.keyword}>"
					       placeholder="请输入关键词"/>&nbsp;
					<input type="submit" id="btnsearch" name="btnsearch" value="搜索"/>
				    </label>
				    <input type="hidden" value="0" id="hidsearchtype" name="hidsearchtype"/>
				</form>
			    </div>
			    <table class="table table-striped table-bordered table-hover table-container">
				<thead>
				    <tr>
					<th width="100px;"><{$app_name2}>号</th>
					<th width="120px;">头像</th>
					<th width="150px;">昵称</th>
					<th width="100px;">性别</th>
					<th width="120px;">手机号码</th>
				<if condition="$login_type eq 2">
				    <else/>
				    <th width="100px;" style="text-align: right;">价格/分钟</th>
				</if>
				<th width="120px;" style="text-align: right;">余额</th>
				<th width="100px;">认证</th>
				<th width="100px;">上下架</th>
				<th width="100px;">状态</th>
				<th width="100px;">个性签名</th>
				<th width="150px;">创建时间</th>
				<th width="200px;" style="text-align: left;">操作</th>
				</tr>
				</thead>
				<tbody>
				<volist name="data" id="vo">
				    <tr id="<{$vo.user_id}>">
					<td><{$vo.user_id}></td>
					<td>
                                    <if condition="$vo.user_logo neq null && $vo.user_logo neq ''"><img class="img"
                                                                                                        alt="未找到图片"
                                                                                                        src="<{$vo.user_logo}>"/>
                                    </if>
				    </td>
				    <td><{$vo.user_name}></td>
				    <td><{$vo.user_sex_text}></td>
				    <td><{$vo.user_phone}></td>
				    <if condition="$login_type eq 2">
					<else/>
					<td style="text-align: right;"><{$vo.user_gold_text}></td>
				    </if>
				    <td style="text-align: right;"><{$vo.balance_text}></td>
				    <td class="idstate"><{$vo.user_idstate_text}></td>
				    <td class="flag"><{$vo.user_flag_text}></td>
				    <td class="state"><{$vo.user_state_text}></td>
				    <td><{$vo.user_describe}></td>
				    <td><{$vo.ctime}></td>
				    <td class="operate" style="text-align: left;">
					<a class="btn btn-rounded btn-info btn-detail"
					   href="__CONTROLLER__/userdetail/uid/<{$vo.user_uid}>" title="详情">详情</a>
                                    <if condition='$login_type eq 2'>
                                        <else/>
                                        <a class="btn btn-rounded btn-info btn-add"
                                           href="__CONTROLLER__/useradd/uid/<{$vo.user_uid}>" title="编辑">编辑</a>
                                        <a class="btn btn-rounded btn-info btn-detail"
                                           href="__CONTROLLER__/userbalancedetail/uid/<{$vo.user_uid}>" title="收支明细">收支明细</a>
                                       
                                        
                                        <a class="btn btn-rounded btn-danger btn-delete" href="javascript:void(0);"
					   onclick="del('<{$vo.user_uid}>')" title="删除">删除</a>
                                        
                                        <if condition='$vo.state eq 3'>
                                            <!--					<a class="btn btn-rounded <{$vo.flag_class}> btn-flag" href="javascript:void(0);" onclick="flag('<{$vo.id}>', '<{$vo.user_flag}>')" title="<{$vo.flag_lab}>" <{$vo.flag_style}>><{$vo.flag_lab}></a>
                                                                <a class="btn btn-rounded <{$vo.flag_switch_class}> btn-flag-switch" href="javascript:void(0);" onclick="flag_switch('<{$vo.id}>', '<{$vo.user_flag_switch}>')" title="<{$vo.flag_switch_lab}>" <{$vo.flag_switch_style}>><{$vo.flag_switch_lab}></a>-->
                                        </if>
                                        <!--					<if condition='$vo.is_lock eq 1'>
                                                                <a class="btn btn-rounded <{$vo.agent_class}> btn-agent" href="javascript:void(0);" onclick="flag_agent('<{$vo.user_uid}>', '<{$vo.is_agent}>')" title="<{$vo.agent_lab}>"><{$vo.agent_lab}></a>
                                                            </if>-->
                                        <!--				    <a class="btn btn-rounded <{$vo.state_class}> btn-state" href="javascript:void(0);" onclick="lock('<{$vo.id}>', '<{$vo.is_lock}>', '<{$vo.state}>')" title="<{$vo.state_lab}>"><{$vo.state_lab}></a>-->
                                    </if>
				    </td>
				    </tr>
				</volist>
				<if condition="($total eq null) or ($total eq 0)">
				    <tr>
					<td colspan="20">没有数据</td>
				    </tr>
				</if>
				</tbody>
			    </table>
			    <div class="dataTables_paginate paging_simple_numbers">
				<ul class="pagination">
				    <if condition="$total gt 0">
					<{$fpage}>
				    </if>
				</ul>
			    </div>
			</div>
		    </div>
		</div>
	    </div>
	</div>
	<!-- 全局js -->
	<script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
	<script src="__PUBLIC__/js/bootstrap.min.js?v=3.3.6"></script>
	<!-- 自定义js -->
	<script src="__PUBLIC__/js/content.js?v=1.0.0"></script>
	<script src="__PUBLIC__/js/plugins/layer/layer.min.js"></script>
	<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
	<script>
						   var userflagsubmit = "<{:U('userflagsubmit','','')}>";
						   var userflagswitchsubmit = "<{:U('userflagswitchsubmit','','')}>";
						   var userlocksubmit = "<{:U('userlocksubmit','','')}>";
						   var useragentsubmit = "<{:U('useragentsubmit','','')}>";
                                                   var deletesubmiturl = "<{:U('userdelete','','')}>";
                                                                                                    
						   function flag(uid, state) {
						       layer.confirm('确定' + (state == '2' ? '下架' : '上架') + '该用户吗？', function (index) {
							   layer.close(index);
							   $.post(userflagsubmit, {'uid': uid},
								   function (data) {
								       if (data.ret == '1001') {
									   layer.msg(data.code, {icon: 6, time: 1000});
									   $tr = $("table tr[id=" + uid + "]");
									   $tr.find(".flag").html(data.data == '2' ? '已上架' : '待上架');
									   $tr.find(".operate .btn-flag").html(data.data == '2' ? '下架' : '上架').attr("title", data.data == '2' ? '下架' : '上架').attr("onclick", "flag(" + uid + "," + data.data + ")").toggleClass("btn-danger").toggleClass("btn-info");
									   if (data.data == '2') {
									       $tr.find(".operate .btn-flag-switch").hide();
									   } else {
									       $tr.find(".operate .btn-flag-switch").html('禁止上架').attr('title', '禁止上架').attr("onclick", "flag_switch(" + uid + ", 1)").addClass("btn-danger").removeClass("btn-info").show();
									   }
								       } else {
									   layer.msg(data.code, {icon: 5, time: 1500});
								       }
								   }, 'json');
						       });
						   }
						   function flag_switch(uid, state) {
						       layer.confirm('确定' + (state == '2' ? '恢复' : '禁止上架') + '该用户吗？', function (index) {
							   layer.close(index);
							   $.post(userflagswitchsubmit, {'uid': uid},
								   function (data) {
								       if (data.ret == '1001') {
									   layer.msg(data.code, {icon: 6, time: 1000});
									   $tr = $("table tr[id=" + uid + "]");
									   $tr.find(".flag").html(data.data == '2' ? '禁止上架' : '待上架');
									   $tr.find(".operate .btn-flag-switch").html(data.data == '2' ? '恢复' : '禁止上架').attr("title", data.data == '2' ? '恢复' : '禁止上架').attr("onclick", "flag_switch(" + uid + "," + data.data + ")").toggleClass("btn-danger").toggleClass("btn-info");
									   if (data.data == '2') {
									       $tr.find(".operate .btn-flag").hide();
									   } else {
									       $tr.find(".operate .btn-flag").html('上架').attr('title', '上架').attr("onclick", "flag(" + uid + ", 1)").removeClass("btn-danger").addClass("btn-info").show();
									   }
								       } else {
									   layer.msg(data.code, {icon: 5, time: 1500});
								       }
								   }, 'json');
						       });
						   }
						   function flag_agent(uid, state) {
						       var msg = state == '2' ? '确定撤销该用户代理身份吗？' : '初始密码为 123456<br />确定将该用户设为代理吗？';
						       layer.confirm(msg, function (index) {
							   layer.close(index);
							   $.post(useragentsubmit, {'uid': uid},
								   function (data) {
								       if (data.ret == '1001') {
									   layer.msg(data.code, {icon: 6, time: 1000});
									   $tr = $("table tr[id=" + uid + "]");
									   $tr.find(".operate .btn-agent").html(data.data == '2' ? '撤销代理' : '成为代理').attr("title", data.data == '2' ? '撤销代理' : '成为代理').attr("onclick", "agentbecome(" + uid + "," + data.data + ")").toggleClass("btn-danger").toggleClass("btn-success");
								       } else {
									   layer.msg(data.code, {icon: 5, time: 1500});
								       }
								   }, 'json');
						       });
						   }
						   function lock(uid, state, idstate) {
						       layer.confirm('确定' + (state == '2' ? '解锁' : '锁定') + '该用户吗？', function (index) {
							   layer.close(index);
							   $.post(userlocksubmit, {'uid': uid},
								   function (data) {
								       if (data.ret == '1001') {
									   layer.msg(data.code, {icon: 6, time: 1000});
									   $tr = $("table tr[id=" + uid + "]");
									   $tr.find(".flag").html('待上架');
									   $tr.find(".state").html(data.data == '2' ? '锁定' : '正常');
									   $tr.find(".operate .btn-state").html(data.data == '2' ? '解锁' : '锁定').attr("title", data.data == '2' ? '解锁' : '锁定').attr("onclick", "lock(" + uid + "," + data.data + ")").toggleClass("btn-danger").toggleClass("btn-info");
									   if (idstate == '3') {
									       if (data.data == '2') {
										   $tr.find(".operate .btn-flag").hide();
										   $tr.find(".operate .btn-flag-switch").hide();
									       } else {
										   $tr.find(".operate .btn-flag").html('上架').attr('title', '上架').attr('onclick', "flag(" + uid + ", 1)").removeClass("btn-danger").addClass("btn-info").show();
										   $tr.find(".operate .btn-flag-switch").html('禁止上架').attr('title', '禁止上架').attr('onclick', "flag_switch(" + uid + ", 1)").addClass("btn-danger").removeClass("btn-info").show();
									       }
									   }
								       } else {
									   layer.msg(data.code, {icon: 5, time: 1500});
								       }
								   }, 'json');
						       });
						   }
						   $hidsearchtype = $("#hidsearchtype");
						   function form_idstate_submit() {
						       $hidsearchtype.val('2');
						       form_submit();
						   }
						   function form_flag_submit() {
						       $hidsearchtype.val('3');
						       form_submit();
						   }
						   function form_submit() {
						       document.getElementById("form1").submit();
						   }
                                                   
                                                   function del(id) {
						       layer.confirm('确定删除吗？', function (index) {
							   layer.close(index);
							   $.post(deletesubmiturl, {uid: id},
								   function (data) {
								       if (data.ret == '1001') {
									   layer.msg(data.code, {icon: 6, time: 1000});
									   setTimeout(function () {
									       window.location.reload();
									   }, 1000);
								       } else {
									   layer.msg(data.code, {icon: 5, time: 1500});
								       }
								   }, 'json');
						       });
						   }
	</script>
    </body>
</html>
